// todo 1. 安装redux yarn add redux
// todo 2. 导入createStore

import { createStore } from 'redux'

const reducer = (
  state = {
    name: 'daj',
    age: 24,
  },
  action
) => {
  if (action.type === 'setDajName') {
    return {
      ...state,
      name: action.payload,
    }
  }

  if (action.type === 'setDajAge') {
    return {
      ...state,
      age: action.payload,
    }
  }
  return state
}
export default createStore(reducer)
